package com.module.circle.ui.circleDetails

import androidx.lifecycle.LiveData
import com.common.app.data.bean.circle.CircleDetailModel
import com.common.app.data.bean.circle.CircleMemberListModel
import com.common.app.data.bean.circle.CircleTaskModel
import com.common.app.data.bean.circle.CirclesRankModel
import com.common.app.data.repository.CircleApi
import com.common.base.app.viewmodel.BaseViewModel
import com.common.base.app.viewmodel.Cancel
import com.common.base.data.CommonBean


/**
 * 作者：sosou
 * <p>
 * 版本：1.0
 * <p>
 * 创建日期：2025/07/24
 * <p>
 * 描述：圈子详情页VM
 * <p>
 * 修订历史：
 */
class CircleDetailsViewModel : BaseViewModel() {

    fun getCirclesDetail(id:Int,error: Cancel?=null): LiveData<CommonBean<CircleDetailModel>> = emit{
        CircleApi.getCirclesDetail(id)
    }

    fun getCirclesMembersList(id:Int,error: Cancel?=null): LiveData<CommonBean<CircleMemberListModel>> = emit(error){
        CircleApi.getCirclesMembersList(id)
    }


    fun getCirclesTask(id:Int,error: Cancel?=null): LiveData<CommonBean<CircleTaskModel>> = emit(error){
        CircleApi.getCirclesTask(id)
    }

    fun getCirclesTaskRank(id:Int,type:String,error: Cancel?=null): LiveData<CommonBean<CirclesRankModel>> = emit(error){
        CircleApi.getCirclesTaskRank(id,type)
    }

    fun requestDelCircles(id:Int,error: Cancel?=null): LiveData<CommonBean<Any>> = emit(error){
        CircleApi.requestDelCircles(id)
    }

    fun requestJoinCircles(id:Int,error: Cancel?=null): LiveData<CommonBean<Any>> = emit(error){
        CircleApi.requestJoinCircles(id)
    }

    fun requestExitCircles(id:Int,error: Cancel?=null): LiveData<CommonBean<Any>> = emit(error){
        CircleApi.requestExitCircles(id)
    }
}